package com.westvalley.ctrl;


import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

import com.jfinal.core.Controller;
import com.jfinal.ext.annotation.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.westvalley.service.api.hr.RemoveTypeService;

@ControllerBind(route="HrApi")
public class HrApiCtrl extends Controller{
	
	public void isHrm(){
		User user = HrmUserVarify.checkUser(getRequest(),getResponse());
		if(user!=null){
			Record record = Db.findFirst("SELECT * FROM HRMROLEMEMBERS WHERE RESOURCEID = ? AND ROLEID = ?", user.getUID(),4);
			if(record!=null)
				renderJson(true);
			else
				renderJson(false);
		}else{
			renderJson(false);
		}
	}
	
	/**
	 * 获取异动类型信息
	 */
	public void getRemoveTypeInfo(){
		renderJson(RemoveTypeService.me(this).getJsonResult());
	}
	
}
